package com.jinhua.usercenter.common;

public class ResultUtils {
    private ResultUtils(){
    }
    public static Result success(){
        return new Result(ErrorCode.SUCCESS.getResultCode(),null);
    }
    public static <T> Result<T>  success(T data){
        return new Result(ErrorCode.SUCCESS.getResultCode(),data);
    }

    public static <T> Result success(int code,T data){
        return new Result(code,data);
    }

    public static <T> Result error(int code,String  message){
        return new Result(code,null,message);
    }

    public static <T> Result error(ErrorCode errorCode){
        return new Result(errorCode);
    }
    public static <T> Result error(ErrorCode errorCode, String message){
        return new Result(errorCode.getResultCode(),message);
    }
}
